
// F. Chaxel 2010

#ifndef SERIAL_H
#define SERIAL_H

#include "ThreadObject.h"

#include "IMicaAdvise.h"

class SerialMica:public ThreadObject
{
	
	private :
		int fd_serial;
		static void *MicaAdviseThread( void *ptrAdvise );
		
		IMicaAdvise *Advised_Object;

	public:
		SerialMica();
		~SerialMica();
		bool Connect(char *serport);
		void Disconnect();
		bool IsOpen();

		void Advise(IMicaAdvise *Listener);
		void UnAdvise(IMicaAdvise *Listener);

	private:
		void Run();
		void Write(char *buf, int lenght);
			
};

#endif
